home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / ccdl150l.zip / IO / FWRITE.C < prev    next >
C/C++ Source or Header  |  1997-02-27  |  448b  |  20 lines

  1. #include <stdio.h>
  2. #include <time.h>
  3. #include <stdlib.h>
  4. #include <string.h>
  5. #include <libp.h>
  6.  
  7. size_t fwrite(void *buf, size_t size, size_t count, FILE *stream)
  8. {
  9.     int len = size * count,i;
  10.     if (stream->token != FILTOK)
  11.         return 0;
  12.     if (!(stream->flags & _F_WRIT)) {
  13.         stream->flags |= _F_ERR;
  14.         return 0;
  15.     }
  16.     for (i=0; i < len; i++)
  17.         if (_baseputc(*((unsigned char *)buf)++,stream) == EOF)
  18.             return i / size;
  19.     return count;
  20. }